package org.gd.hellojaxb.privat24.paninfo;

import org.gd.hellojaxb.utils.Marshall;
import org.gd.hellojaxb.utils.MarshallProperties;

import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.*;
import java.io.IOException;
import java.util.ArrayList;

@XmlRootElement(name = "doc")
@XmlAccessorType(XmlAccessType.FIELD)
public class PanInfoResponse extends ArrayList<PanInfoResponseCard> {

    public PanInfoResponse() {
        super();
        add(new PanInfoResponseCard());
        add(new PanInfoResponseCard());
    }

    @XmlElementWrapper(name = "r")
    @XmlElement(name = "O")
    @SuppressWarnings("unused")
    private PanInfoResponse getThis() {
        return this;
    }

    @Override
    public String toString() {
        try {
            return Marshall.getInstance().marshal(this, MarshallProperties.WITHOUT_XML_HEADER);
        } catch (Throwable e) {
            return super.toString();
        }
    }

    public static void main(String...args) throws JAXBException, IOException {
        System.out.println(new PanInfoResponse().toString());
    }
}
